repo.or.cz
/
andmenj-acm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Namespacing everything to /UVa.
[andmenj-acm.git]
/
UVa
/
11461 - Square numbers
/
11461.cpp
blob
41527669acf53e54446fe57b3187c3a298c7c421
1
#include <iostream>
2
#include <algorithm>
3
#include <cmath>
4
using namespace
std
;
5
6
const int
SIZE
=
100000
;
7
8
int
f
[
SIZE
+
1
];
9
10
int
main
(){
11
f
[
0
] =
0
;
12
int
k
;
13
for
(
int
i
=
1
;
i
<=
SIZE
; ++
i
){
14
f
[
i
] =
f
[
i
-
1
] + ((
k
= (
int
)
sqrt
(
i
)) *
k
==
i
);
15
}
16
int
a
,
b
;
17
while
(
cin
>>
a
>>
b
&&
a
+
b
){
18
if
(
a
>
b
)
swap
(
a
,
b
);
19
cout
<<
f
[
b
] -
f
[
a
-
1
] <<
endl
;
20
}
21
return
0
;
22
}